//
//  Student.m
//  OC2_实例变量可见度_方法
//
//  Created by dllo on 16/2/25.
//  Copyright © 2016年 Apon. All rights reserved.
//

#import "Student.h"

@implementation Student
#pragma mark - 重写init
- (instancetype)init{
    self = [super init];
    if (self) {
        
        _classroomName = @"DLS160101";
    }
    return self;
}


#pragma mark - 重写父类方法

/** 
 *重写父类方法时, 父类方法不用在.h文件中声明, 直接在.m文件中实现即可. 
 */
- (void)sayHi{
    
    /** 
     * super 是编译器指令, 指调用父类方法.
     * [super sayHi] 是但前对象调用父类的方法, 而不是父类对象调用sayHi方法.
     */
    [super sayHi];
    
    NSLog(@"grade:%f, classroomName:%@", _grade, _classroomName);
}


#pragma mark - setter, getter
/** setter, getter */
- (void)setGrade:(float)grade{
    
    _grade = grade;
    
}
- (float)grade{
    
    return _grade;
}

- (void)setclassroomName:(NSString *)classroomName{
    
    _classroomName = classroomName;
    
}
-(NSString *)classroomName{
    
    return _classroomName;
}
@end
